package com.hu.web.servlet;

import com.hu.web.entity.Employee;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class BaseServlet extends ViewBaseServlet {

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setAttribute("msg","共享数据");

        List<String> nameList = new ArrayList<>();
        nameList.add("Java");
        nameList.add("MySQL");
        nameList.add("Redis");
        request.setAttribute("nameList", nameList);

        List<Employee> employeeList = new ArrayList<>();
        employeeList.add(new Employee(101, "小明", 0, 500.0));
        employeeList.add(new Employee(102, "小红", 1, 800.0));
        employeeList.add(new Employee(103, "小芳", 1, 1000.0));
        request.setAttribute("employeeList", employeeList);

        this.processTemplate("base", request, response);
    }

}
